package com.shell.governor.modules.service.impl;

import com.shell.bee.persistence.service.impl.PersistentServiceImpl;
import com.shell.governor.authorization.po.PubRole;
import com.shell.governor.modules.dao.PubBizRoleDao;
import com.shell.governor.modules.po.PubBizRes;
import com.shell.governor.modules.po.PubBizRole;
import com.shell.governor.modules.service.PubBizResService;
import com.shell.governor.modules.service.PubBizRoleService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PubBizRoleServiceImpl extends PersistentServiceImpl<PubBizRole> implements PubBizRoleService {
	@Autowired
	PubBizResService pubBizResService;
	@Autowired
	PubBizRoleDao pubBizRoleDao;

	public void delBizRole(String bizId, String roleId) {
		PubBizRole bizRole = new PubBizRole();
		bizRole.setBizId(bizId);
		bizRole.setRoleId(roleId);
		deleteEntity(bizRole);

		PubBizRes bizRes = new PubBizRes();
		bizRes.setBizId(bizId);
		bizRes.setRoleId(roleId);
		this.pubBizResService.deleteEntity(bizRes);
	}

	public List<PubRole> findBizRoles(String bizId) {
		return this.pubBizRoleDao.findBizRoles(bizId);
	}
}
